﻿@model FCDB.Entity.FormNoContractPay
@using FB.Extensions;
@{
    ViewBag.Title = "非合同款项支付审核表";
    Layout = "~/Views/Shared/_FormLayout.cshtml";
    var IsViewMode = Model.Status != (short)FCDB.Entity.FormStatusEnum.Empty && Model.Status != (short)FCDB.Entity.FormStatusEnum.Draft;

}
@section HeadIncluder
{
    <link href='@Url.Content("~/Content/public.css")' rel="stylesheet" />
    <link href='@Url.Content("~/Content/con_style.css")' rel="stylesheet" />
}
@{
    Html.RenderPartial("UCFormButtonBar", Model);
}
<div class="frombox" id="formMain">
    <div class="from_l" style="background: #fff;">
        <div class="left_con_f PrintArea">

            <div align="center" class="left_f_tit">非合同款项支付审核表)</div>
            @using (Html.BeginForm("SaveFormNoContractPay", "Form", FormMethod.Post, new { id = "frm" }))
            {
                Html.RenderPartial("UCHiddenArea");
                <table width="100%" class="left_xx">
                    <tr>
                        <td class="text_w" align="center">
                            流程名称：
                    </td>
                    <td colspan="5">
                        @if (IsViewMode)
                        {
                            @Model.FormTitle
                        }
                        else
                        {
                            <input id="txtFormTitle" style="width:98%;" class="validate[required] in_c1 " type="text" name="FormTitle" value="@Model.FormTitle" />
                        }
                    </td>
                </tr>
                <tr>
                    <td class="text_w" align="center">审批序号</td>
                    <td>
                        @if (IsViewMode)
                        {
                            @Model.FormNumber
                        }
                        else
                        {
                            <input type="text" id="FormNumber" style="width:100px;" class="in_c1" value="@Model.FormNumber" name="FormNumber" />
                        }
                    </td>
                    <td class="text_w" align="center">
                        货币类型
                    </td>
                    <td>
                        @if (IsViewMode)
                        {
                            @Model.CurrencyType
                            <input type="hidden" id="CurrencyType" name="CurrencyType" value="@Model.CurrencyType" />
                        }
                        else
                        {
                            var CURR = new string[] { "人民幣", "港幣", "美元" };

                            <select id="CurrencyType" name="CurrencyType" class="in_c1">
                                @foreach (var c in CURR)
                                {
                                    var selected = Model.CurrencyType == c ? " selected='selected'" : "";
                                    <option value="@c" @selected>@c</option>
                                }
                            </select>
                        }
                    </td>
                    <td class="text_w" align="center">
                       日期
                </td>
                <td>
                    @if (IsViewMode)
                    {
                        @Model.FormDate.Value.ToString("yyyy-MM-dd")
                    }
                    else
                    {
                        <input type="text" id="FormDate" class="in_c1" value="@Model.FormDate.Value.ToString("yyyy-MM-dd")" name="FormDate" />
                    }
                </td>
            </tr>
            <tr>
                <td class="text_w" align="center">申请部门 </td>
                <td>
                    @if (IsViewMode)
                    {
                        @ViewBag.DepartmentName
                    }
                    else
                    {
                        <input type="text" disabled="disabled" style="width:100px" id="DepartmentName" class="in_c1" value="@ViewBag.DepartmentName" name="DepartmentName" />
                        <input id="DeparmentID" type="hidden" name="DeparmentID" value="@Model.DeparmentID" />
                    }
                </td>
                <td class="text_w" align="center">申请人</td>
                <td>
                    @if (IsViewMode)
                    {
                        @ViewBag.UserName
                    }
                    else
                    {
                        <input type="text" class="in_c1" style="width:100px" disabled="disabled" id="UserName" name="UserName" value="@ViewBag.UserName" />
                        <input id="DraftUserID" type="hidden" name="DraftUserID" value="@Model.DraftUserID" />
                    }
                </td>
                <td class="text_w" align="center">合同类型<a style="color:red;position:relative; top:3px">*</a></td>
                <td>
                    @if (IsViewMode)
                    {
                        @Model.ContractType
                    }
                    else
                    {
                        <select id="ContractType" name="ContractType" class="validate[required] in_c1 ">
                            <option value="人力">人力</option>
                            <option value="行政">行政</option>
                            <option value="营销">营销</option>
                            <option value="其他">其他</option>
                        </select>
                    }
                </td>
            </tr>
            <tr>
                <td class="text_w" align="center">项目名称<a style="color:red;position:relative; top:3px">*</a></td>
                <td colspan="5">
                    @if (IsViewMode)
                    {
                        @Model.ProjectName
                    }
                    else
                    {
                        <input type="text" id="ProjectName" name="ProjectName" class="validate[required] in_c1 " style="width:98%" value="@Model.ProjectName" />
                    }
                </td>
            </tr>
            <tr>
                <td rowspan="5" class="text_w" align="center"> 收款单位（人）</td>
                <td colspan="1" class="text_w" align="center">公司名称<a style="color:red;position:relative; top:3px">*</a></td>
                <td colspan="4">
                    @if (IsViewMode)
                    {
                        @Model.CompanyName
                        <input type="hidden" id="txtCompanyName" name="CompanyName" value="@Model.CompanyName" />
                    }
                    else
                    {
                        <input type="text" class="validate[required] in_c1 " id="CompanyName" name="CompanyName" value="@Model.CompanyName" />

                    }
                </td>
            </tr>
            <tr>
                <td class="text_w" align="center">开户银行 <a style="color:red;position:relative; top:3px">*</a> </td>
                <td colspan="4">
                    @if (IsViewMode)
                    {
                        @Model.BankName
                    }
                    else
                    {
                        <input type="text" class="validate[required] in_c1 " id="BankName" name="BankName" value="@Model.BankName" />
                    }
                </td>
            </tr>
            <tr>
                <td class="text_w" align="center">账号 <a style="color:red;position:relative; top:3px">*</a></td>
                <td colspan="4">
                    @if (IsViewMode)
                    {
                        @Model.BankAccount
                    }
                    else
                    {
                        <input type="text" class="validate[required] in_c1 " id="BankAccount" name="BankAccount" value="@Model.BankAccount" />
                    }
                </td>
            </tr>
            <tr>
                <td class="text_w" align="center">联系人</td>
                <td colspan="4">
                    @if (IsViewMode)
                    {
                        @Model.ContactName
                    }
                    else
                    {
                        <input type="text" class="in_c1 " id="ContactName" name="ContactName" value="@Model.ContactName" />
                    }
                </td>
            </tr>
            <tr>
                <td class="text_w" align="center">联系方式  </td>
                <td colspan="4">
                    @if (IsViewMode)
                    {
                        @Model.ContactStyle
                    }
                    else
                    {
                        <input type="text" class="in_c1 " id="ContactStyle" name="ContactStyle" value="@Model.ContactStyle" />
                    }
                </td>
            </tr>
            <tr>
                <td rowspan="2" class="text_w" align="center">申请金额</td>
                <td colspan="1" class="text_w" align="center">小写：￥<a style="color:red;position:relative; top:3px">*</a></td>
                <td colspan="4">
                    @if (IsViewMode)
                    {
                        @Html.formatCash(Model.LowWord)
                        <input type="hidden" id="LowWord" name="LowWord" value="@Model.LowWord" />
                    }
                    else
                    {
                        <input type="text" class="validate[required] validate[custom[number]] in_c1" onchange=upLowWord() id="LowWord" name="LowWord" value="@Model.LowWord" />
                    }
                </td>
            </tr>
            <tr>
                <td class="text_w" align="center">大写：</td>
                <td colspan="5">
                    @if (IsViewMode)
                    {
                        @Model.UpWord
                    }
                    else
                    {
                        <input type="text" id="UpWord" name="UpWord" style="width:220px" class="in_c1" readonly="true" value="@Model.UpWord" />
                    }
                </td>
            </tr>
           
            <tr>
                <td rowspan="2" class="text_w" align="center">经办事项说明情况 <a style="color:red;position:relative; top:3px">*</a></td>
                <td colspan="5">
                    @if (IsViewMode)
                    {
                        @Html.ApplyBR(Model.Content)
                    }
                    else
                    {
                        <textarea id="Content" name="Content" cols="20" class="validate[required] in_c1 " style="width: 98%; height: 40px;" rows="2">@Model.Content</textarea>
                    }
                </td>
            </tr>
            <tr>
                <td class="text_w" align="right" colspan="5">
                   经办人：
                @if (IsViewMode)
                {
                    @ViewBag.UserName
                }
                else
                {
                    <input readonly="true" type="text" class="in_c1" style="width:50px" value="@ViewBag.UserName" />
                }
            </td>
        </tr>
        <tr>
            <td class="text_w" align="center">归属公司<a style="color:red;position:relative; top:3px">*</a></td>
            <td colspan="6">
                @if (IsViewMode)
                {
                    @Model.BillType
                
                    <input type="hidden" id="BillType" name="" value="@Model.BillType" />
                }
                else
                {
                   <input type="text" class="validate[required] in_c1 " style="width:95%" id="BillType" name="BillType" value="@(Model.BillType.IsEmpty() ? "深圳市汇盈咨询服务有限公司" : Model.BillType)" />
                }
            </td>
        </tr>
        <tr>
            <td class="text_w" align="center">最终审批人 </td>
            <td colspan="5">
                @if (IsViewMode)
                {
                    <input name="EndChecker" type="radio" disabled="disabled" value="财务总监" /><i>财务总监</i>
                    <input name="EndChecker" type="radio" disabled="disabled" value="总经理助理" /><i>总经理助理</i>
                    <input name="EndChecker" type="radio" disabled="disabled" value="总经理" /><i>总经理</i>
                    <input name="EndChecker" type="radio" disabled="disabled" value="终审" /><i>终审</i>
                }
                else
                {
                    <input name="EndChecker" type="radio" disabled="disabled" value="财务总监" /><i>财务总监</i>
                    <input name="EndChecker" type="radio" disabled="disabled" value="总经理助理" /><i>总经理助理</i>
                    <input name="EndChecker" type="radio" disabled="disabled" value="总经理" /><i>总经理</i>
                    <input name="EndChecker" type="radio" disabled="disabled" value="终审" /><i>终审</i>
                }
            </td>
        </tr>
        <tr class="printArea_disable">
            <td class="text_w" align="center">备注 <a style="color:red;position:relative; top:3px">*</a></td>
            <td colspan="5">
                @if (IsViewMode)
                {
                    @Html.ApplyBR(Model.Remark)
                }
                else
                {
                    <textarea id="Remark" class="in_c1 validate[required]" name="Remark" cols="20" style="width: 98%; height: 80px;" rows="2">@Model.Remark</textarea>
                }


            </td>
        </tr>
    </table>
            }
            <form style="display:none" action="@Url.Action("SaveFormNoContractPayBillDue", "Form")" id="frmOTInfoConfirm">
                <input type="hidden" name="ProcessGuid" value='@Request["ProcessGuid"]' />
                <input type="hidden" name="ID" value="@Model.ID" />
                <input type="hidden" name="FormGuid" value="@Model.FormGuid" />
                <input type="hidden" name="Status" value="@Model.Status" />
                <table style="width:100%;height:36px; border:none;">
                    <tr>
                        <td class="text_w" align="center" style="width: 151px;">
                            出纳
                        </td>
                        <td style="border-bottom: none; border-top: none; border-right: none; ">
                           出纳金额
                        @if (Model.BillDue.HasValue)
                        {
                            <span> @Html.formatCash(Model.BillDue.Value.ToString()) </span>
                        }
                        else
                        {
                            <input type="text" id="txtBillDue" name="BillDue" value="@Model.BillDue" />
                        }
                    </td>
                </tr>
            </table>
        </form>

      
    @{
        Html.RenderPartial("UCFormCheckLog");
    }

</div>
</div>
<div class="from_r">
    <div class="right_con_f">
        <div class="f_fj">
            @{
                Html.RenderPartial("UCFormAttachment", (IList<FCDB.Entity.FormAttachment>)ViewBag.FormAttachments);
            }
        </div>
        <div class="f_fj">
            @{
                Html.RenderPartial("UCFormsRelation", (IList<FCDB.Entity.FormsRelation>)ViewBag.FormsRelations);
            }

        </div>
        <div class="xx_yj">
            <p class="yj_tit">详细意见</p>
            <div class="con_yj">
                @{
                    Html.RenderPartial("UCFormCirculatedDocumentLog", (IList<FCDB.Entity.FormCirculatedDocumentLog>)ViewBag.FormCirculatedDocumentLogs);
                }
            </div>
        </div>

    </div>
</div>
</div>

<script src=@Url.Content("/Scripts/jquery.form.js") type="text/javascript"></script>
<script src=@Url.Content("/Scripts/foa.form.js?v=20140904") type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#frm").validationEngine({ promptPosition: "topLeft" });
        $("#FormDate").kendoDatePicker({
            format: "yyyy-MM-dd",
            value: new Date()
        });
        $("#BillType").val("@Model.BillType");
        $("#ContractType").val("@Model.ContractType");
        upLowWord();
        var kendo = $("#FormDate").data("kendoDatePicker");
        var formStatus = $("#hStatus").val();

        var ProccessActiveContainerList = $(".ProccessActiveContainer");
        if (ProccessActiveContainerList.length > 0) {
            $.each(ProccessActiveContainerList, function (i, item) {
                var divId = $(item).attr("id");
                var frmID = divId.slice(3);
                $("#" + frmID).appendTo(item);
                $("#" + frmID + " select").attr("disabled", "disabled");
                $("#" + frmID + " input").attr("disabled", "disabled");
                $("#" + frmID).show();
            });
            $(".curentContainer form select").removeAttr("disabled");
            $(".curentContainer form input").removeAttr("disabled");
        }
    });
    function upLowWord() {
        var num = Arabia_to_Chinese($("#LowWord").val());
        $("#UpWord").val(num);
        var FormTitle = '@Model.FormTitle';
        $("#txtFormTitle").val(FormTitle + "--金额:" + $("#LowWord").val());
    }


    function Save() {
        var formStatus = $("#hStatus").val();
        if (formStatus == "0" || formStatus == "1") {
            var flag = $('#frm').validationEngine('validate');
            if (!flag) return false;
            GetProcessCheckUser(null, null, function (selectPostList) {
                if (selectPostList != null || selectPostList != undefined) {
                    var arr = new Array();
                    $.each(selectPostList.UserIDList, function (i, item) {
                        var obj = new Object();
                        obj.Key = item.UserID;
                        obj.Value = item.Name;
                        arr.push(obj);
                    });
                    selectPostList.UserIDList = arr;
                    var checkUserList = selectPostList;
                    if (checkUserList == null) return;

                    var FormConditionValue = JSON.stringify(GetFormCondition());
                    var options = {
                        data: {
                            FormAttachement: GetFormAttachement(), FormsRelation: GetFormsRelation(),
                            CheckLogUser: JSON.stringify(checkUserList.UserIDList),
                            NextActivityGuid: checkUserList.ActivityGuid, FormConditionValue: FormConditionValue
                        },
                        success: function (data) {
                            alert("表单发送成功");
                            window.close();
                        }
                    };
                    $("#hStatus").val("2");
                    $("#frm").ajaxSubmit(options);
                }
            });
        }
        else {
            submitCheckLog();
        }
    }
    function SaveAsDraft() {
        var flag = $('#frm').validationEngine('validate');
        var options = {
            data: { FormAttachement: GetFormAttachement(), FormsRelation: GetFormsRelation() },
            success: function (data) {
                alert("保存成功");
                window.close();
            }
        };
        $("#hStatus").val("1");
        $("#frm").ajaxSubmit(options);
    }

</script>


